import { BasicColumn } from '/@/components/Table';
import { h } from 'vue';
import { Input, InputNumber, Image, Select } from 'ant-design-vue';
// import { useUserStore } from '/@/store/modules/user';
import Level1 from '/@/assets/images/level/level1.gif';
import Level2 from '/@/assets/images/level/level2.gif';
import Level3 from '/@/assets/images/level/level3.gif';
import Level4 from '/@/assets/images/level/level4.gif';
import Level5 from '/@/assets/images/level/level5.gif';
import Level6 from '/@/assets/images/level/level6.gif';
import Level7 from '/@/assets/images/level/level7.gif';
import Level8 from '/@/assets/images/level/level8.gif';
import Level9 from '/@/assets/images/level/level9.gif';
import Level10 from '/@/assets/images/level/level10.gif';
import Level11 from '/@/assets/images/level/level11.gif';
import Level12 from '/@/assets/images/level/level12.gif';
import Level13 from '/@/assets/images/level/level13.gif';
import Level14 from '/@/assets/images/level/level14.gif';
const imgList = [
  {
    label: 'level1',
    value: Level1,
  },
  {
    label: 'level2',
    value: Level2,
  },
  {
    label: 'level3',
    value: Level3,
  },
  {
    label: 'level4',
    value: Level4,
  },
  {
    label: 'level5',
    value: Level5,
  },
  {
    label: 'level6',
    value: Level6,
  },
  {
    label: 'level7',
    value: Level7,
  },
  {
    label: 'level8',
    value: Level8,
  },
  {
    label: 'level9',
    value: Level9,
  },
  {
    label: 'level0',
    value: Level10,
  },
  {
    label: 'level11',
    value: Level11,
  },
  {
    label: 'level12',
    value: Level12,
  },
  {
    label: 'level13',
    value: Level13,
  },
  {
    label: 'level14',
    value: Level14,
  },
];
console.log('imgList', imgList);
// const userStore = useUserStore();
// const serverInfo = userStore.getServerInfo;

export const columns: BasicColumn[] = [
  {
    title: '在线时长',
    dataIndex: 'newLevel',
    key: 'newLevel',
    width: 100,
    customRender: ({ record }: any) => {
      return h(InputNumber, {
        value: record['newLevel'],
        onChange(value) {
          record['newLevel'] = value;
        },
      });
    },
  },
  {
    title: '描述',
    dataIndex: 'desc',
    key: 'desc',
    customRender: ({ record }: any) => {
      return h(Input, {
        value: record['desc'],
        onChange(e) {
          record['desc'] = e.target.value;
        },
      });
    },
  },
  {
    title: '图片',
    dataIndex: 'levelPicPath',
    key: 'levelPicPath',
    customRender: ({ record }: any) => {
      // serverInfo.rootPath +
      // (record['levelPicPath'] && record['levelPicPath'].startsWith('/')
      //   ? record['levelPicPath']
      //   : `/${record['levelPicPath']}`),
      return h(
        'div',
        {
          style: 'display:flex;align-items:center',
        },
        [
          h(Select, {
            showSearch: true,
            options: imgList,
            value: record['levelPicPath'],
            style: 'width:50%',
            getPopupContainer: () => document.body,
            onChange(value) {
              record['levelPicPath'] = value;
            },
          }),
          h(Image, {
            preview: false,
            src: record['levelPicPath'],
          }),
        ],
      );
    },
  },
];
